

#define RX8025_ADDR 0x32

#define SECONDS_REG 	0X00
#define MINUTES_REG 	0X01
#define HOUR_REG 		0X02
#define WEEK_REG 		0X03
#define DAY_REG 		0X04
#define MONTH_REG 		0X05
#define YEAR_REG 		0X06
//#define A1_SECONDS_REG 	0X07
#define A1_MINUTES_REG 	0X08
#define A1_HOUR_REG 	0X09
#define A1_DATE_REG		0X0A
#define COUNTER_0 	    0X0B
#define COUNTER_1 	    0X0C
#define EXT_REG 	    0X0D
#define FLG_REG  	    0X0E
#define CT_REG 		    0X0F

typedef struct{
  uint8_t hour;
  uint8_t minutes;
  uint8_t seconds;
  uint8_t day;
  uint8_t month;
  uint16_t year;
}RX8025_TIME;

void RX8025Init(void);
uint8_t RX8025_read(uint8_t reg);
void RX8025_write(uint8_t reg, uint8_t data);
uint8_t decToBcd(uint8_t val);
uint8_t bcdToDec(uint8_t val);

void RX8025SetDate(uint8_t year, uint8_t month, uint8_t date);
void RX8025SetTime(uint8_t hour, uint8_t minutes, uint8_t seconds);
void RX8025SetTimerPerMinute(void);

void RX8025StartA1(void);
void RX8025StartA2(void);
void RX8025ClearA1(void);
void RX8025ClearA2(void);

void RX8025ReadAll(uint8_t *temp);
void RX8025GetTime(RX8025_TIME *time);
